#include <iostream>
#include <thread>
#include <unistd.h>
#include "thread.hpp"
using namespace sdf;

int printf(int num)
{
    int cnt = 5;
    while(cnt--)
    {
        std::cout << "cnt: " << cnt << std::endl;
        sleep(1);
    }
    return num;
}
int main()
{
    Thread thread(10，print);
    thread.start();
    std::cout << thread.GetId() <<std::endl;
    uint64_t ret = (uint64_t)thread.join();

    return 0;
}



/*__thread int g_val = 10;
void* ThreadRun(void* args)
{
    for(int i=0; i<5; ++i)
    {
        std::cout<< "new thread g_val: " << g_val << std::endl;
        //新线程对全局变量g_val进行++
        g_val++;
        sleep(1);
    }
    return nullptr;
}
int main()
{
    //创建新线程
    pthread_t tid;
    pthread_create(&tid, nullptr, ThreadRun, nullptr);

    for(int i=0; i<5; ++i)
    {
        std::cout << "main thread g_val: " << g_val << std::endl;
        sleep(1);
    }
    
    void* retval = nullptr;
    pthread_join(tid, &retval);

    return 0;
}*/
